package com.test.exercise.impl;

import com.test.exercise.Sequence;

/**
 * description: SequenceA 实现 Sequence 接口
 * @version v1.0
 * @author w
 * @date 2018年12月1日下午4:05:58
 **/
public class SequenceA implements Sequence  {
	
	// private  int num = 0 ; 不添加 static,结果也是一样
	private static int num = 0 ;
	
	@Override
	public int getNum() {
		num = num + 1;
		return num;
	}
	
	public static void main(String[] args) {
		Sequence sequence = new SequenceA();
		// 创建3个线程对象
		Thread t1  = new ClientThread(sequence);
		Thread t2  = new ClientThread(sequence);
		Thread t3  = new ClientThread(sequence);
		
		// 启动三个线程
		t1.start();
		t2.start();
		t3.start();
	}
}
